package com.atguigu.chaptar3

object $02_Construct {
  class Person(private var name:String,var age:Int=20,address:String){//主构造器
    //辅构造器
    def this(name:String)={
      //第一行必须调用主构造器或者其他辅构造器
      this(name,address="beijing")
    }
    def getAddress()=this.address
  }

  def main(args: Array[String]): Unit = {
    val person = new Person("wzx", address="loudi")
    println(person.getAddress())
    val zy = new Person("zy")

  }


}
